<?php
    @header('Content-type:text/html;charset=utf-8');

    #PHP 的数组 

    // 在 PHP 中，有三种类型的数组：
    // 数值数组 - 带有数字 ID 键的数组;
    // 关联数组 - 带有指定的键的数组，每个键关联一个值;
    // 多维数组 - 包含一个或多个数组的数组;


    // 数值数组 
    $arr = array("a","b","c");
    $arr2 = ["a","b","c"];

    // 关联数组
    $list = array("name"=>"zkl","age"=>18,"sex"=>"男性");
    // print_r($list);

    // foreach($list as $val){
    //     echo $val."<br>";
    // }

    // foreach($list as $key=>$val){
    //     echo $key."::::".$val."<br>";
    // }

    // 多维数组
    $arr2 = [1,2,[3,4,[5,6]]];
    $arr3 = array(1,2,array(3,4,array(5,6)));
    // echo $arr3;
    $arr4 = array(
        1,
        2,
        array(
            3,
            4,
            array(
                5,
                6
            )
        )
    );

    // 关联数组 (多维)
    $goods = array(
        "gid"=>"A001",
        "gname"=>"大大的风衣",
        "gimg"=>"http://47.104.209.44/base/img/3.jpg",
        "gprice"=>1002,
        "gdesc"=>"真的很柔软,good"
    );

    // [{},{},{},{}]

    $goodList = array(
        array(
            "gid"=>"A001",
            "gname"=>"大大的风衣",
            "gimg"=>"http://47.104.209.44/base/img/3.jpg",
            "gprice"=>1002,
            "gdesc"=>"真的很柔软,good"
        ),
        array(
            "gid"=>"A001",
            "gname"=>"大大的风衣",
            "gimg"=>"http://47.104.209.44/base/img/3.jpg",
            "gprice"=>1002,
            "gdesc"=>"真的很柔软,good"
        ),
        array(
            "gid"=>"A001",
            "gname"=>"大大的风衣",
            "gimg"=>"http://47.104.209.44/base/img/3.jpg",
            "gprice"=>1002,
            "gdesc"=>"真的很柔软,good"
        ),
        array(
            "gid"=>"A001",
            "gname"=>"大大的风衣",
            "gimg"=>"http://47.104.209.44/base/img/3.jpg",
            "gprice"=>1002,
            "gdesc"=>"真的很柔软,good"
        ),
        array(
            "gid"=>"A001",
            "gname"=>"大大的风衣",
            "gimg"=>"http://47.104.209.44/base/img/3.jpg",
            "gprice"=>1002,
            "gdesc"=>"真的很柔软,good"
        )
    );

    echo $goodList;
?>
